package cn.wsalix.shop.entity;


import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import lombok.Data;
import lombok.EqualsAndHashCode;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import cn.anlaser.entity.SimpleEntity;
import cn.wsalix.admin.entity.SysUser;
import cn.wsalix.user.entity.AccountPay;


@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "FINANCIAL")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@EntityListeners({ AuditingEntityListener.class })
@Data
@EqualsAndHashCode(callSuper = false)
public class Financial extends SimpleEntity {
    private String account;
    private String annexCode;
    private BigDecimal srcAmount;
    private BigDecimal endAmount;
    private BigDecimal amount;//支付金额
    private Date confirmTime;
    private String payType;
	@ManyToOne(cascade = CascadeType.MERGE, optional = true, fetch = FetchType.LAZY)
	@JoinColumn(foreignKey = @ForeignKey(name = "FK_FINANCIAL_ACCOUNTPAY"), name = "ACCOUNTPAY_ID")
	private AccountPay accountPay;// 支付账号
	
	@ManyToOne(cascade = CascadeType.MERGE, optional = true, fetch = FetchType.LAZY)
	@JoinColumn(foreignKey = @ForeignKey(name = "FK_FINANCIAL_AFFIRMANT"), name = "AFFIRMANT_ID")
	private SysUser affirmant;// 确认客服

}
